/* -----------------------------------------------------------------------
 * Becky Kluth
 * CS 362
 * Assignment 3: cardtest3.c to test village card (refactored)
 *
 * cardtest3: cardtest3.c dominion.o rngs.o
 *      gcc -o cardtest3 -g  cardtest3.c dominion.o rngs.o $(CFLAGS)
 * -----------------------------------------------------------------------
 */

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

//set NOISY_TEST to 0 to remove printfs from output (this macro taken from the example)
#define NOISY_TEST 0

int main() {
    int seed = 1000;							//initiate game with 2 players
    int numPlayer = 2;
    int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};
    struct gameState G;
	int startingHandCount;
	int startingActions;
	int noCrash;

    initializeGame(numPlayer, k, seed, &G);

	printf("Testing card: village\n");
	startingHandCount = G.handCount[0];			//get player 0 hand count
	startingActions = G.numActions;				//get number of actions

#if (NOISY_TEST == 1)
     printf("Test player 0 starts with %d cards in hand and %d actions.\n", startingHandCount, startingActions);
#endif
	noCrash = cardEffect(village, 0, 0, 0, &G, 1, 0);		//village card, should add 1 card and 2 actions, then discard card
	assert(noCrash == 0);
	assert(G.handCount[0] == startingHandCount);		//check against starting hand count
	assert(G.numActions == startingActions + 2);		//check against starting actions

#if (NOISY_TEST == 1)
     printf("Test player 0 ends with %d cards in hand and %d actions.\n", G.handCount[0], G.numActions);
#endif

    printf("All tests passed!\n");

    return 0;
}
